%% Calculate the surface area of high-speed rail
function [S_2]=area(h1,c)
    %Set parameters
    high=4.05;	% High speed rail height
    width=3.3;	% High speed rail width
    Length=20;	% Total length of the front end

    %The first area is a circular platform
    r1=16; %The radius above the frustum
    r2=19; %The radius below the frustum
    S_21=0.5*pi*(r1+r2)*sqrt((r2-r1)^2+h1^2);  %Area of the frustum

    %The second area is an inverted circular table
    r3=r1;
    r4=Length;
    h2=0.5; %Given the height of h2, determine the size of the second block area
    S_22=0.5*pi*(r3+r4)*sqrt((r4-r3)^2+h2^2);

    %The third piece has an area of half an elliptical paraboloid
    a=0.5*width;
    h3=high-h1-h2;
    b=h3;
    res_2= ellipse(a,b,c);
    S_23=res_2;

    %The fourth block has an area of half a cylinder
    r5=h3;  %radius
    S_24=pi*r5*(Length-c);
    
    %total area
    S=S_21+S_22+S_23+S_24;
    S_2=S;
end